﻿using MathS = System.Math;

#if F32
	using Num = System.Single;
	namespace Reign.Core.MathF32
#endif
#if F64
	using Num = System.Double;
	namespace Reign.Core.MathF64
#endif
#if I32
	using Num = System.Int32;
	namespace Reign.Core.MathI32
#endif
{
	/// <summary>
	/// Provides constants and common mathematical functions.
	/// </summary>
	public static class Math
	{
		#region Properties
		/// <summary>
		/// Represents the ratio of the circumference of a circle to its diameter, specified by the constant, π.
		/// </summary>
		public const Num Pi = (Num)3.1415926535897932384626433832795;

		/// <summary>
		/// Represents the ratio of the circumference of a circle to its diameter, specified by the constant, π, multiplied by 2.
		/// </summary>
		public const Num Pi2 = (Num)6.283185307179586476925286766559;

		/// <summary>
		/// Represents the ratio of the circumference of a circle to its diameter, specified by the constant, π, divided by 2.
		/// </summary>
		public const Num PiHalf = (Num)1.5707963267948966192313216916398;

		/// <summary>
		/// Represents 1 divided by the ratio of the circumference of a circle to its diameter, specified by the constant, π.
		/// </summary>
		public const Num PiMul = (Num)0.31830988618379067153776752674503;

		/// <summary>
		/// Zero Number Type.
		/// </summary>
		public const Num Zero = 0;

		/// <summary>
		/// Half Number Type.
		/// </summary>
		public const Num Half = (Num)0.5;

		/// <summary>
		/// One Number Type.
		/// </summary>
		public const Num One = 1;

		/// <summary>
		/// Two Number Type.
		/// </summary>
		public const Num Two = 2;

		/// <summary>
		/// 180 Deg Number Type.
		/// </summary>
		private const Num Deg180 = 180;
		#endregion

		#region Methods
		/// <summary>
		/// Converts Degrees to Radians.
		/// </summary>
		/// <param name="degrees">Degrees</param>
		/// <returns>Radians</returns>
		public static Num DegToRad(Num degrees) {return ((degrees / Deg180) * Pi);}

		/// <summary>
		/// Converts Radians to Degrees.
		/// </summary>
		/// <param name="radians">Radians</param>
		/// <returns>Degrees</returns>
		public static Num RadToDeg(Num radians) {return ((radians / Pi) * Deg180);}
		#endregion
	}
}